package meituan.summer11;

import java.io.*;

/**
 * @Author Fizz Pu
 * @Date 2021/4/29 下午6:41
 * @Version 1.0
 * 失之毫厘，缪之千里！
 */
public class ReadInfoTest {
    public static void main(String[] args) throws IOException {

        BufferedReader br = new BufferedReader(new FileReader("/home/fizz/Leetcode/src/meituan/summer11/test.txt"));
        String line = br.readLine();
        String[] data = line.trim().split(" ");

        int offset = 1;
        boolean start = false;
        int counter = 0;
        int nextData = 0;
        int index = 0;
        int len = data.length;

        while (index < len) {
            String ch = data[index++];
            if(!start){
                System.out.println(offset + ": ");
            }
            System.out.print(ch + " ");
            if (!start) {
                start = true;
                counter = 0;
            }
            if (start) {
                counter++;
            }
            if (counter == 2) {
                nextData = Integer.parseInt(ch);
            }
            if (counter == nextData + 4) {
                System.out.println();
                counter = 0;
                start = false;
                offset++;
            }
        }
    }
}
